<?php
session_start();
if(empty($_SESSION['auth_username']) && empty($_SESSION['auth_password']))
{
header('Location: ../index.php');
} else if ($_SESSION['auth_level'] == 1)
{
header('Location: ../index.php');
}
include 'class_user.php';
$user = new User;
?>

<div id="admin_function">
<a href="admin.php"> Zur&uuml;ck zum Admincenter </a><br/>

<h1> Userverwaltung </h1>
<?php

if ($_GET['loeschen'])
{
$user->delete($_GET['loeschen']);
}

if ($_POST['submit'])
{
$id = $_GET['id'];
$user->updateU($id,$_POST['wort']);

}
?>


<table>
<tr><th>L&ouml;schen</th><th>Edit</th><th>ID</th><th>Username</th><th>Level</th></tr>
<?php

$user->anzeigen();
?>
</table>

<?php

if($_GET['id'])
{
$id = $_GET['id'];
?>
<h2>User-Level editieren</h2>
<form action="userverwaltung.php?id=<?php echo $id; ?>" method="post">
ID:
<?php echo $id; ?>
 <select name="wort">
      <option value="1">User</option>
      <option value="2">Mod</option>
	  <option value="3">Admin</option>
 </select>
<input type="submit" name="submit" value="&Auml;ndern">
</form>
<?php


}

?>
</div>
